package com.fang.concurrency.chapter3;

public class CreateThread4 {

	private static int counter = 1;

	public static void main(String[] args) {

		/**
		 * 控制线程虚拟机栈的大小stackSize
		 */
		Thread t1 = new Thread(null, new Runnable() {
			@Override
			public void run() {
				try {
					add(1);
				} catch (Error e) {
					System.out.println(counter);
				}
			}

			private void add(int i) {
				counter++;
				add(i + 1);
			}
		}, "Test", 1 << 24);// 1<<24 8M
		t1.start();
	}
}
